/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package concurrent.queue;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.text.StyledEditorKit;

/**
 *
 * @author harker777
 */
public class ProducerConsumerDemo {

	private static final Integer PRODUCERS_NUMBER = 2;
	private static final Integer CONSUMERS_NUMBER = 2;

	public static void main(String[] args) {
		spawnProducers();
		spawnConsumers();
	}

	private static void spawnProducers() {
		Thread[] producers = new Thread[PRODUCERS_NUMBER];

		for (int i = 0; i < PRODUCERS_NUMBER; i++) {
			producers[i] = new Thread(new Producer(), "Producer #" + (i + 1));
			producers[i].start();
		}
	}

	private static void spawnConsumers() {
		Thread[] consumers = new Thread[CONSUMERS_NUMBER];

		for (int i = 0; i < CONSUMERS_NUMBER; i++) {
			consumers[i] = new Thread(new Consumer(), "Consumer #" + (i + 1));
			consumers[i].start();
		}
	}
}
